/**
@file tilespair.cpp
@brief TilesPair class methods implementation

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.

@author VestniK (Sergey N.Vidyuk)
 */
#include "tilespair.h"

using namespace mjn;

bool TilesPair::isValid() const {
   if ( tiles.count() != CombinationSize ) {
      return false;
   }
   Tile first,second;
   first = tiles.first();
   second = tiles.last();
   if ( first == second ) {
      return true;
   }
   return false;
}

unsigned TilesPair::calculateScore(WindType roundWind,WindType playerWind) const {
   if ( tiles.first().getSuit() == Tile::Dragon ) {
      return 2;
   }
   if ( tiles.first().getSuit() == Tile::Wind ) {
      if ( (int)tiles.first().getRank() == (int)roundWind ) {
         return 2;
      }
      if ( (int)tiles.first().getRank() == (int)playerWind ) {
         return 2;
      }
   }
   return 0;
}

unsigned TilesPair::calculateMultiplyFactor(WindType roundWind,WindType playerWind) const {
   return 1;
}
